package io.renren.modules.mark.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class MailUtils {
    @Value("${spring.mail.username}")
    private String username;

    @Autowired
    private JavaMailSender mailSender;

    public void sendMails(List<String> list,String datasetName){
        for (String s : list) {
            SimpleMailMessage message = new SimpleMailMessage();
            message.setFrom(username);
            message.setTo(s);
            message.setSubject("图片标注任务");
            message.setText("您有新的图片标注任务,任务名称："+datasetName);
            mailSender.send(message);
        }
    }
}
